﻿<%@ WebHandler Language="C#" Class="SIPO.Web.AjaxHandler.Loaddata.getDueDateLetterForRecDemand" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using SIPO.Library.DataAccess.Transaction;
using SIPO.Library.DomainObject.Transaction;
using SIPO.Library.Enum;
using SIPO.Web.Support;
using Newtonsoft.Json.Linq;
using System.Text;

namespace SIPO.Web.AjaxHandler.Loaddata
{
    public class getDueDateLetterForRecDemand : SIPO.Web.BaseHandler
    {

        recDemandRepo recDemandDal = new recDemandRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);

        public override void ProcessRequest(HttpContext context)
        {
            base.ProcessRequest(context);

            DateTime? letterDate = context.Request["LetterDate"].Equals(string.Empty) ? (DateTime?)null : Helper.FormatDate(context.Request["LetterDate"], Helper.Culture.Indonesian);
            string sLetterDate = letterDate == null ? string.Empty : string.Format("{0:yyyy-MM-dd}", letterDate);
            int transTypeId = int.Parse(context.Request.Params["TransTypeId"]);
            
            DateTime? dueDateLetter = recDemandDal.GetDueDateLetter(sLetterDate,transTypeId);

            StringBuilder sbProject = new StringBuilder();

            sbProject.Append("{");
            sbProject.AppendFormat("  {0}DueDateLetter{0}:{0}{1}{0}", "\"", dueDateLetter);
            sbProject.Append("}");

            context.Response.Write(sbProject.ToString());
        }

        public override bool IsReusable
        {
            get
            {
                return false;
            }
        }

    }
}